<?php

use kartik\select2\Select2;
use yii\helpers\Html;
use yii\bootstrap\ActiveForm;
use dosamigos\datepicker\DatePicker;

/* @var $this yii\web\View */
/* @var $model common\models\Company */
/* @var $branch common\models\Branch */
?>

<div class="company-form">

    <?php $form = ActiveForm::begin(['options' => ['enctype' => 'multipart/form-data']]); ?>
    <fieldset>
        <legend>Company</legend>
        <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?>

        <div class="form-group">
            <label class="control-label">Choose Logo</label>
            <input type="file" name="file">
        </div>

        <?= $form->field($model, 'email')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'address')->textInput(['maxlength' => true]) ?>

        <?= $form->field($model, 'status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive'], ['prompt' => 'Please choose...']) ?>

        <?= $form->field($model, 'started_at', ['enableAjaxValidation' => true])->widget(
            DatePicker::className(),
            ['clientOptions' => ['autoclose' => true, 'format' => 'yyyy-mm-dd']]
        ) ?>

        <?= $form->field($model, 'province')->widget(
            Select2::className(),
            ['data' => ['上海' => 'SH', '北京' => 'BJ'], 'options' => ['placeholder' => 'Select a State...']]
        ) ?>
    </fieldset>
    <fieldset>
        <legend>Branch belongs to the company</legend>
        <?= $form->field($branch, 'name') ?>

        <?= $form->field($branch, 'address') ?>

        <?= $form->field($branch, 'status')->dropDownList(['active' => 'Active', 'inactive' => 'Inactive',], ['prompt' => 'Please Select...']) ?>
    </fieldset>
    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
